import request from '@api/request';
import { HttpUrl } from '@api/httpUrl';

// 下载客户列表模板
export function downloadCustomerTemplate() {
    return request.get(HttpUrl.downloadCustomerTemplate, {
        responseType: 'blob',
    });
}

// 下载产品列表模板
export function downloadProductTemplate() {
    return request.get(HttpUrl.downloadProductTemplate, {
        responseType: 'blob',
    });
}

// 下载供应商列表模板
export function downloadSupplierTemplate() {
    return request.get(HttpUrl.downloadSupplierTemplate, {
        responseType: 'blob',
    });
}

// 下载产品图稿
export function downloadProductDesign(src: string) {
    return request.get(HttpUrl.downloadProductDesign, {
        params: { src },
        responseType: 'blob',
        timeout: 0,
    });
}

// 下载订单文件
export function downloadOrderFile(src: string) {
    return request.get(HttpUrl.downloadOrderFile, {
        params: { src },
        responseType: 'blob',
        timeout: 0,
    });
}

// 预览静态文件
export function previewStaticFile(src: string) {
    return request.get(HttpUrl.previewStaticFile, {
        params: { src },
        responseType: 'blob',
        timeout: 0,
    });
}

// 下载静态文件
export function downloadStaticFile(src: string) {
    return request.get(HttpUrl.downloadStaticFile, { params: { src } });
}
